package com.emre.daoGenerator.dbSchema;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.jdbc.core.JdbcTemplate;

import java.io.Serializable;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: emre
 * Date: 19.04.2011
 * Time: 20:23
 * To change this template use File | Settings | File Templates.
 */
@Configurable
public class SchemaInspector implements Serializable{
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public SchemaInspector()
    {
        super();
    }

    public List<String> queryForTableNames()
    {
        String schemaName = "fttx_envanter";
        List<String> tableNames = jdbcTemplate.queryForList("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = " + schemaName, String.class);
        return tableNames;
    }


    public int queryForTableCount()
    {
        return jdbcTemplate.queryForInt("SELECT COUNT(*) FROM CIHAZ");
    }
}
